<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <script src="../js/vue.js"></script>
    </head>
    <body>
        <div id="app">
            <p>{{title}}</p>
            <my-component></my-component>
        </div>
        <template id="tmp1">
            <p>{{title}}</p>
        </template>   
        <script>//注册计数器组件
             Vue.component('my-component',{
                 template:'#tmp1',
                 data : function(){
                     return{ title : '我是组件内的title'}
                 }
             });
             var vm = new Vue({
                 el:'#app',
                 data : {
                     title : '我是vm实例中的title'
                 }
             });
        </script>
    </body>
</html>